<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016-06-06
 * Time: 10:46
 */
class PregMacth
{

    private  $str;
    private  $reg;


    public function __construct($str,$reg)
    {
        $this->str = $str;
        $this->reg = $reg;
    }

    public  function reg(){
       preg_match ($this->reg, $this->str,$aa);
        var_dump($aa);
    }


    public function regAll(){
        preg_match_all($this->reg, $this->str,$aa);
        var_dump($aa);
    }

    public  function setReg($reg){
        $this->reg = $reg;
    }

    public  function setStr($str){
        $this->str = $str;
    }
}





/*$teststr = " color: '#191970',
 Axis: 1, 
 marker: { symbol: 'square' }, 
 data: [100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100] 
 }]
  });
   }); 
      });  ";

$reg = "/data: \[[\d+,]+\d+\]/";

$preg = new PregMacth($teststr,$reg);
$preg->reg();*/



$parten1='/(\d){2}/';
$parten2='/(\d)(\d)/';
$parten3='/\d(\d)/';
$parten4='/(\d\d)/';
$parten5='/\d\d/';

$preg = new PregMacth('abc12effffs56ss',$parten1);
$preg->reg();
$preg->setReg($parten2);
$preg->reg();
$preg->setReg($parten3);
$preg->reg();

$preg->setReg($parten4);
$preg->reg();

$preg->setStr('2011-13-21-17');
$preg->setReg("/((19|20)[0-9]{2})-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01]) "
				."([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/");
$preg->reg();






